using System;
using FluentNHibernate.Conventions;
using FluentNHibernate.Conventions.Instances;

namespace Caramel.FluentNHibernate.Conventions
{
	public class DefaultStringLengthConvention : IPropertyConvention
	{
		public DefaultStringLengthConvention()
			: this(256)
		{
		}

		public DefaultStringLengthConvention(int length)
		{
			this.Length = length;
		}

		public int Length { get; set; }

		public void Apply(IPropertyInstance instance)
		{
			instance.Length(this.Length);
		}
	}
}
